package com.sxxm.qxgl.controller;


import com.sxxm.qxgl.dto.RoleMenu_list;
import com.sxxm.qxgl.entity.RoleMenu;
import com.sxxm.qxgl.entity.UserMenu;
import com.sxxm.qxgl.entity.UserRole;
import com.sxxm.qxgl.service.RoleMenuService;
import com.sxxm.qxgl.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 角色菜单权限表 前端控制器
 * </p>
 *
 * @author qjw
 * @since 2021-09-14
 */
@RestController
@Api(value = "角色-菜单", tags = "角色-菜单")
@RequestMapping("/role-menu")
public class RoleMenuController {
    RoleMenuService roleMenuService;

    public RoleMenuController(RoleMenuService roleMenuService) {
        this.roleMenuService = roleMenuService;
    }

    @ApiOperation("角色添加菜单")
    @PostMapping("/tjyh")
    public Result tjyh(@RequestBody RoleMenu_list userRoles){
        return roleMenuService.Batch_add(userRoles);
    }

    @ApiOperation("角色删除菜单")
    @PostMapping("/Delete")
    public Result Delete(@RequestBody List<RoleMenu> userRoles){
        return roleMenuService.Delete(userRoles);
    }

    @ApiOperation("通过角色id查询菜单返回字符串")
    @PostMapping("/cxyhcd")
    public Result cxzfc(@RequestBody RoleMenu userMenu){
        return roleMenuService.cxzfc(userMenu);
    }
}

